package com.Tadama.Forms;

import com.Tadama.MIDlet.TadamaMIDlet;
import com.Tadama.Utility.CommandBuilder;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import org.netbeans.microedition.lcdui.WaitScreen;
import org.netbeans.microedition.util.SimpleCancellableTask;

public class lstCategorias extends List implements CommandListener{
    private TadamaMIDlet mainMIDlet;
    private Command cmExit = CommandBuilder.getExit();
    private Command cmSelect = CommandBuilder.getSelect();
    private static final String[]MENU_ITEMS={"Categiria 01",
                                             "Categoria 02",
                                             "Categoria 03",
                                             "Categoria 04",
                                             "Categoria 05"};
    public lstCategorias(TadamaMIDlet mainMIDlet,Displayable previusDisplay){
        super("Categorias", IMPLICIT);
        this.addCommand(cmExit);
        this.addCommand(cmSelect);
        this.setCommandListener(this);
        this.mainMIDlet = mainMIDlet;
        for(int i =0;i<=4;i++){
            this.append(MENU_ITEMS[i],null);
        }
    }
        
    public void commandAction(Command c, Displayable d) {
        int menuIndex = this.getSelectedIndex();
        if(c==lstCategorias.SELECT_COMMAND || c== cmSelect){
            Display.getDisplay(mainMIDlet).setCurrent(new frmWaitScreem(getDisplay(),mainMIDlet,this,2));
        }
    }
    public Display getDisplay() { return Display.getDisplay(mainMIDlet); }
}
